package com.jtlrm.ckd.mvp.view.adapter;

import android.text.TextUtils;
import android.view.View;

import com.base.sdk.util.DataUtil;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.jtlrm.ckd.R;
import com.jtlrm.ckd.entity.YinShiDataEntity;

public class YinShiDataAdapter extends BaseQuickAdapter<YinShiDataEntity, BaseViewHolder> {

    public YinShiDataAdapter() {
        super(R.layout.yin_shi_data_item);
    }


    @Override
    protected void convert(final BaseViewHolder helper, YinShiDataEntity item) {
        helper.setText(R.id.date, item.getBasicTime());
        if (TextUtils.isEmpty(item.getId())) {
            helper.getView(R.id.content_container).setVisibility(View.GONE);
            helper.getView(R.id.add_data).setVisibility(View.VISIBLE);
            helper.getView(R.id.status).setVisibility(View.GONE);
            helper.getView(R.id.arrow).setVisibility(View.GONE);
        } else {
            helper.getView(R.id.content_container).setVisibility(View.VISIBLE);
            helper.getView(R.id.add_data).setVisibility(View.GONE);
            helper.getView(R.id.status).setVisibility(View.VISIBLE);
            helper.getView(R.id.arrow).setVisibility(View.VISIBLE);
            helper.setText(R.id.status, item.getAuditingState());
            helper.setText(R.id.neng_liang, DataUtil.subZeroAndDot(item.getEnergy()));
            helper.setText(R.id.dan_bai_zhi, DataUtil.subZeroAndDot(item.getProtein()));
            helper.setText(R.id.jia, DataUtil.subZeroAndDot(item.getPotassium()));
            helper.setText(R.id.na, DataUtil.subZeroAndDot(item.getSodium()));
            helper.setText(R.id.lin, DataUtil.subZeroAndDot(item.getPhosphorus()));
            helper.setText(R.id.gai, DataUtil.subZeroAndDot(item.getCalcium()));
            helper.setText(R.id.shui_fen, DataUtil.subZeroAndDot(item.getWater()));
        }
    }

}
